Move misplaced functions into their proper module
Remove unused datatype