compiles but not outputting correctly