added helper functions for loading the mnist dataset.