Fixes and Refactoring.