Cleaned up and formatted sample code.