Stabilizes and cleans some code