fixed addToOrder and added table creation function