Add kernel and some fixes