remove extra loop, variable initialization

remove extra loop, variable initialization