Changing the working principle to operate with function