initial logic - incorrect result