replaced usage of map with andThen