refactoring the tablet controller into its own class