GUI database code clean up