ADDED Database handling for apps