code with functions