Added constructor that uses database

cool