Refactor to modules

All deprecated code moved to modules, that skips compilation. Result library contain only stable code.