Functions WS 14 - code cleanup and comments