fixed some errors and added unit tests