Added functions to migrations and view