Code review with conor, added function and commenting