removed debugging of table, refactored