Completed logical exercise