ticket:2 complete ticket, added tests
ticket:3 fix