fixed duplicate counting bug
cleanup