Starting massive refactoring of rcp.py