Implementing more functions and fixing tests.
Fixed merge conflicts.