clean up code and prepare for db exp