Separate detect related functions into their own file

TODO: Create platform specific detect functions