modified idin func