Moved variable placement for better performance