Cleaned up a little. Added some nice comments. Removed some jQuery dependency.