Functions WS 18 - code cleanup and more comments