Implementations for supportfunctions

These functions should be enough to solve the first problem.
There are differing strategies regarding the commit messages though.
Adds debug variables and fixes some minor bugs
adds uppg1