added database & pagination