started cleaning up code, see notes ..not working for now