Added code and comments