Rewrite for better management/legibility