generalised for any size board