Move read function to package