Move code around to reduce number of .load calls