Fix ADL problems on Windows + some small optimizations