edited conditional check to be simpler