code cleanup and DB connection closing
hopefully cleaner exit
Converted UUIDs to strings to work with DB