Restructure, and add pagination