Refactored and added prerequisites. Failure messages are more descriptive.