rewrote much of the stuff, leaner code