Major Refactoring. UI separated from core classes.