Slight change in the API of the internal functions
Code cleanup