WTF?? I have removed most of the code and it seems to work perfectly!!!!!!