Added some extra functions. No changes to the external API.