Adding main functionality, DB connection