Moved Database functionality to external class