removed empty stack optimization - requires more research