add unit tests
clenaup code