Refactor tables and measurement sets