10% speed increase (and messy code)