moved constants and functions to separate files for tidiness