Moved some functions around
More functions moved, minor semantics