adding pieces to connect to database in reusable manner