moved encoding at top of file