added working code and gemfile skeleton