major refactor (part 2)

* merge main#question related helpers in json_helper for now
* move code from environment.rb to app/lib file
* unify question reachability handling