working version as of Aug 2