Re-factored the code to make room for other scripts