fix covariate loading bug and improve UI
refactor functions