Update gems and clean up code