Moved functionality to tests