Implemented saving table to file and some fixes.