comments added + some formatting has been done