updated to apply recent changes