First working version, simplified algorithm, changed containers, removed pointless methods.