resolve issue #4
cleanup repeated code to keep it DRY