Refactor to use pytables and simpler slicing