Exposing some internal functions for testing purposes