made function inline and global static. Should work fine over multiple files.