Less global variables, prettier code and better file parsing