updated with functions