More work on mat library