Changed to more generic if check