Make code functional