Some old, bad code fixed