removed duplicate logic