moved some functions around

Signed-off-by: Alexander Skjolden <alex@plastboks.net>