Fixed code style and changed some comments