more refactoring. Fixed screen transitions.