Clean up syntax

Cleanup and lint syntax, move vars to top of method, add link to Github repository and lay out conditions.