fixing bugs and makes a few changes 3