pretty fugly way to do this