Fixed some functions
Improved test suite