some minor refactoring and add 'id' field to the Entry class.