Tidying up Programming assignment 1