Moved spawningsystem to functions