made code dry