Safety commit. Big reworking