Added missing imports and other tweaks.