remove the existing view before adding a new main view