Major cleanup

Signed-off-by: Mattias Åkerman <mattias@tunity.se>