code refactoring
complex test added