Issue #27 Lifecycle stuff, ready for final review pass

Before I start implementing this all over the place!
How is this supposed to work - based on Enum's constant comparisons? So if we're in the middle of UNINITIALIZED.init(), this will return MAINTENANCE, but in MAINTENANCE.close() this will give you MAINTENANCE? And then failed() below seems to be doing something similar, based on the order of constant declarations in the enum.