refactored events and model controling