separated middleware from ui and game