tidying up build files and applying codenarc to problems