model is global
document loaded function