adds validity checks to legs collecting funtion