Fixed circular reference dependence on  & added some error validation.