Modified to use map