Refactor main loop
Keep log folder
Set ruby version in Gemfile