database functions and basic view