Fix bug when handling post-dependencies with --nodeps

Fixes #1.

The buggy method has had some refactoring to make it easier to understand.