tabview and some refactoring