Little code cleaning + make secure some code parts