changed some variables around, fixed dict issues