Working version with ajax & IE support