Finished logic.

Still testing with pre set values