merged with David original repo