Splitting the non gui functionalities out of diwacs.py