Major refactoring. Started to implement Editor.