cleaned up some copy-paste code