Remove obsolete code
Document more the code

Fix the order of inclusion to fix the ender generation