add locals to reduce code verbosity