Moved some functions