removed if/else replaced with just ifs on js