added read code, still need to fix linker error