improve services code