Added export table functionality and fixed a thing