lesson learned: coding while half asleep is a bad idea