refactored and debugged get from DB functions