adding tie condition and using constants