Reworked js

Added models instead of having scope functions