refactor encounters form controller