Changed to use database