modified and added tests