Fixed bug where app would exit with a BAD_ACCESS error.
Some changes.