Reorganization for unit testing and renaming for clarity/consistency