version 4, clean up main