Added mate condition and fixed checks
Separated classes into files, further refactoring
Refactored interface