Tweaked README.md and rearranged some code