fixing bugs and cleaning