clean up js biz logic and views and sorting