added sql script for creating database
changed various files to simplify and reformat code