Improvements based on James D. review