add character counter, refactor a few things