added paging and flushing
made files protected variables