working from db