Added support for undefined classes. These will be ignored instead of causing the function to throw an error.