Added comments and new funtions.