updated to newer code