Finished the logic.