Move it into a seperate js script so it can be used anywhere