Add ability to enter new collection UDFs and edit saved collection UDFs

Clearly -1 is a magic number, but it's tough to tell what it signifies. Consider making a descriptive constant.