You need to make this a module. Plus encapsulate your variables. As this code is almost usable to developers until you do both.