cleanup copy-paste code