Updated API Example

Made the code a little more readable for future use.