Fix enconding
Improve overall structure