Implement & test tidy function