Renamed tables, more oragnized. Some more code optimizations.