Made tests, fixed code.