refactored ui and referee