amended variable check to have parameters passed directly