General bug fixes, added main function and moved project into visual studio.