logic for the lab