added some unit tests and it's working