Layout fix for pages that don't define measures; moved some view code to controller