simplified repeated code