updated table parser, refactored code