fixes # 31 | refactoring code