detailed comments added