Continued implementation, added tests