Device api spec testing, controller, and views refactoring