Making functions flexible