Various fixes/improvements.