Bug fixes and refactoring.