Added a lot of tests and improved some functions