some refactoring around the serve-context