Fixes

Merged lot of fixes/improvements, made some myself.