beta version. Need refactoring and documentation