Added null and effect populations. This is not yet working.
Simplified and cleaned up for debugging.