added more code
split views and js to separate file.