fixing bugs and improvingstyle