map line function revised