Pertified code and put location js into seperate file