Bugs fixed and code review