Fixed settings window call and minor code refactoring.