Broke down the onCreate() method

Split onCreate() up into some smaller methods which each did different
things. This way, it is easier to understand what the code does, and
find and work with it later.