Added comments and reformatting