commenting graphics code and tidying up functional decomposition