Added annotated version of the code