Bug fixes, Refactoring