Code first part with functions