set up GET and refactored code