reintegrated your code