base code for service