all transitions prototyped and code re-factored