Moved code from test repo