Working version(runnable)

The results are incorrect, this will be fixed shortly.