newer code, and most recently fixed the crashing