Trying to do unified functions - buggy