A Latvian computer code writer who admitted a role in spreading a virus to over a million computers worldwide, including some at NASA, can return home after serving over 20 months in prison.

Deniss Calovskis was sentenced to time served Tuesday by a in New York City. Calovskis pleaded guilty last summer to conspiring to commit computer intrusion.

The judge said she was impressed by his rehabilitation.

His had called for Calovskis to face 18 months to two years in prison.

Prosecutors say from 2005 to 2012, the virus infected 40,000 U.S. computers, including 190 at NASA.

Calovskis says he knew what he was doing was wrong when he wrote code for the Gozi virus.