Refactoring 'functions' method.