some reworking, cleanup, more to do