implementing counting and lines function