prev, next page demo. some refactoring. fix for login.