Modified to make it available to use anywhere