Cleanup: removed dead code
Simplified code and minor refactoring
Assume UTF-8 as a sane default
Cleanup: aligned naming