Refactorings and Minor improvements to usability