Adding comments and tidying