move out logic from view