function code completed - add new comments