Refactored the javascript.
Removed superflous gunk.
Refactored and added additional functionality