Fixed null pointer exception, and refactored code to separate the Result table gui from the logic