Refactor for readability and rethrow exceptions