initial solution completed using map