some DRY and removal of deprecated code