runnable version, needs tuning