finially completed refactor of js model