Issue #27 Added error handling in lifecycle, plus javadoc