Initial implementation - still needs tested.