Moved main logic from scala classes to java.
Added clashes filtering.