some light refactoring of states and model usage

@simpulton for your review