Add comments and restructure remote code.