added dbreader and refactored a little