Fixed a few binningbugs and fixed the begin ios reset bug. Added a few debug statements.