Updated README with basic instructions.
Cleaned up the code a bit and made it a bit more robust.