moved order around in file
updated for gradle changes
fixed screen rotation issue by doing a replace rather than an add
trapped npe when rotation before return