Fixing loop shenanigans