small bug fixes, reorganizing, etc.