Few changes from Ziyann's kernel, thanks to him