Added 15 unit tests and some new functions