dismantling old reader code into smaller functions; adding reader interface