move declare encoding to top