Enhanced the functions