repo refactored a little