included repeat instruction and refactored