Simplified code. It no longer handles stack manipulations but will be marginally faster.