Removed warnings and updated the sample method