refined controller
updated tests