clean it up, drop table and use matrix. fix handling of data.frames. checks required