added compatibility for any board size