Move staging to BUILD copy logic from template to library