rebased and tested changes