already looking quite good, except for serious memory leak