first version but with some encoding problems