Refactoring to Model API for making it stricter and safer