Removed some obsolete code.
Moved some code from header to source.