NEXUS-5704: cleanup and commented changes

Using fail() instead to make intention clear.
Cleanup of imports.