Moving ul outside for loop