Fixed ugly code.