Functions must be defined before using them in onLoad for imports