Huge improve of code optimization