Formatting, comments and test added