Added tests and fixed CS