Reorganized code to follow ApplicationView