Moving all custom cuntions and declarations to custom.lua to be able to upgrade compat.lua and global.lua