Built document parser and added sort logic [sorting needs to be fixed]