more thougths for functions refactor