Fixed the problems that Nikhil pointed out