Wasn't calling function properly