Implement stackmachine. Fix a whole lot of stuff