Major thanks to Nicholas Corgan!

Added changes to make code more portable, per the work of ncorgan.
Restructured files and folders.