Split input and state stuff in to modules