add counter func
made makefile