Fixed some bugs. Code compiles and tested on device. Passes test from assignment.