changes and added tests