adding recursive cost function