Few Changes. Please check the code.