made several changes based on dave's observations