Formalise the factored representation. Fix #57