updated for 1.7 (tested)