cost implementation with db support