Cleaning the kernel and improving some features

Cleaning several points listed in the TODO list of the developers.