code fix and final cleanup