replaced database layer