Refine board input and fix dangling pointers