#4 Logic implemented