Tests, Models and functions rewritten