changed reading function