updated for 2.1 and renamed a few variables