creates code and inserts record into db
redirects
works on a basic level
code cleanup