refactor members controller, add tests