fixed code style & some small errors