updated and added tests