add unit tests
error handling + quality improvements