Added a main file
Minor testing and tweaking