ban.cpp refactoring