refactor; adding states