Clean up (and correct) sourcemap logic and test