Added lots more tests and functions