Remove some duplication in compositing