Last changes before competition. Refactoring is needed.