Added comments and modified function names