Preparing for mysql

Major refactoring.
Prepared data and execution strcuture.
Refactor to observer pattern