fixed up some helpers and logic errors