Bit efficient code - lagoon handling