updated methods and added tests