read file and assemble