refectored project.

see commit messages.