improvement of some poor programming