modified database access to use content provider and added image cache func