add main view logic