Changed python code to new encoding
Switched to stack-based language