remove extra function and fixed conditional