Refactored image layer building functions