Moved generic code into ernkit