Moved some funcitons