cleaner+better error reporting. fixed simid1,simid2 swap bug. shortened table name to only relevant part