Bug fixes

Multiple bug fixes and removal of unneeded code. List of bugs in comment
log in MainActivity.java