refined functions for creating tables