Refactoring code. Finally fix queen rules.