some cruft removed