Added comments and a few style changes