Switched hash inter, cleaned up code and added db.sql (not tested yet)