Converted Sudo to real code (with TODO)