updated with jkc and other tweaks