Added comments and histogram function