Minor code reorganization and a fix for a spacing issue