Added reading functions (need some testing)