Switched to problem ids for identifying problems.

This should save a whole load of queries too.