compiles, runs but works only partially