Fix positions table

This PR adds a check to avoid updating positions table after first phase. It also adds a method for table regeneration. It will run in the console.
Awesome. Move it and merge it directly. No need of further review.