Removed unreachable code and some comments added