ideal table function, but not working