Fixes NPE in Dialog for Perspective selection plus minor code cleanup