Finalized the new shader system

- Fixed all factory-related errors
- Implemented almost all missing functionality
- Merge with master soon