create repo wrapper and refactor alot