Various fixes/improvements