started reorganizing code, NOT WORKING