changed indents to 2 spaces
added code conventions

added comments to if statements and fixed indentation for some functions