Some more refactoring. Programm compiles now.
Merge pull request #1 from MarkGrin/refactoring

Some more refactoring. Programm compiles now.