Refactor get spot code.