merged reader implementaton from both implementations