Can you post the whole code and exactly what is it doing or not doing?