some bugs removed + test coverage up to 83%