Moved main body of logic into it's own parameterized function, updated README.md