added comments to method and fixed a comparison