moved some codes