some changes, but not tested yet