cleanup repeated code