Minor code refactoring; clean up Gemfile