Fixes and optimizations on models and pagiantor