Refactor contest helper