density method implemented