Added checkstyle and tidied up code.