fixed formatting and added tests