Refactor shader code