refactor in controller, change ordering
fix incorrect behavior for mark_all