Fixed compile time errors and wrote simple unit tests