Server api threading and memory callbacks refactored. Warning: breaking changes