Fixing old bad code