added logic to v