start count function. still needs a lot of work.