Made the script more modular and added ability run without installation