Added API functionality

As a standard practice, let's do this after all parameters have been validated so it's not executed when they're not valid.