updated to get rid of unnecessary vars.