Move initaliation of variables into a procedure