code with functions and branches