better code structure for file reloading