Added unit tests for Material and some minor clean-up