Refactored javascript to several files and integrated update_meta_post.