Beginning of an encoding with functions