Fixed bug when registry doesn't contain a 'ProgramFiles' key. Commented and optimised pathfromreg function.