added templates and connection to MongoDB