Small code refactoring and documentation update