refactored the reader and cleaned up the API