Reformatting code and tidying up.