Added tests and fixed duplicate scounter