assignment fix and refactor