Reorganize Shader Setup

This removes some duplicated code and makes things a bit more clear.