cleaned up code, fixed indentation and added comments. Also added score