ticket:47 add tests and change code
8 files changed