modify database structure and optimize some models