First cut working implementation