It's functionally fine, but should probably be refactored into a func, rather than duplicating code.