Fixed poor code