Race magic keys
more refactoring