added tests and changed methods.