Replaced with more complete code