abstract logic to AppHelper, add mocha tests
add history support
simplify by tracking prev page