Moved some preprocessing functions around.