Slow but functioning version