Moved bunch of functions into commonmod