refactoring to MVP pattern