added some typing and more shader invalidation