some improvements, not finished