do the same with less code