Upgrade gem dependencies and clean up some code.