final code cleanup and testing on 4.0.0-beta2