Moved parameters out of server and changed logic order