Splitting functions to util.py for better use.