Added comments, and made the API use U and X registers.