pseudocode for most of the logic in the server side of the engine