#91 code refactoring