Moved more logic to ApplicationState