Moved some functions from command to server