Prototyped ToSys and wrote intetrnal function