Cleaned up code a bit

added comments and fixed spacing and such