fixed paginating bug
improved file organization