Prepared for refactoring. Moved source code from application library.