Refactor table class