Added tests and more functions