More methods and some minor refactoring.