less duplicated code