Added some code to handle shaders - not tested yet.