adding a class and tidying things up