Upgrade gems and small refactor to handler