Refactor js services to work with function expression