Moved common stuff to a separate module