create table and code cleanup