fixing bugs and makes a few changes 2