Per Olav Flaten Backlog ID 1.3
 - Major fix to functionality and bugs.
 - Lots of code cleanup.