fixed D.R.Y. issue