revert to fix some bugs  commented code still in  will probably come up later