Ported Windows code to Linux; first commit