#231 fixed. #169 refactoring #236 fixed