Javascript Documentation & Code Cleanup