Various tweaks, better handling of input.