Added SQL database calls to project, fixed several bugs in the process.