Many fixes and clarify for the core when what happend. Fixes gliches of the previous script.