added start of console code and fixed bug which caused high load on file load thanks to jgmdev for pointing it out