Addition of more commenting to the code

Make the code more understandable to read and to work out also more
maintanable