Moved check function in to a shared library since it is being used in 3 scripts now