Refactoring, now seem to be on the last right way