Updated with functions