General improvements, thx @johnbergvall @mikaelbrandt