Changed all of writes to connect to DB using constants file