add service information, error codes and refactor code