Version 0.3

Rewritten algorithm