Moved some variables into lower levels