Started to implement database functions