Slight code reorganization