cleanup portal.cpp