Home page additions, sql functions, added more main logic