Refactor and fixes mostly for physis sample