Refactor some js file organisation + prepare libs for routing