reducing the amount of code in ram to free up space

You seem reluctant to post the full source but given the discussion I think you'll find it beneficial to yourself to do so.