Matrix, spaces and AND / OR refactoring