added dynamic model creation code