beautification and added tests