#115 removing duplicated code