replace push with map
add line breaks at the end of files