Fix numbering algorithm - now more complex again