Add getEntry() method and some refactoring