Fixed unintentional global functions and unused variables.

Closes #1.