Cleaned up the code

Annotated to clear up what is going on in the code, removed some stray
comments and functions that were later never hooked into WordPress.