Rermove unused code
Remove duplicate logic