Working version with returns stack now in memory rather than in register