Added comments and fixed a bug that allowed a mutable array to be returned.
Added comments
Added comments