documented the code
changed method to work in place