De-duplicate with above code?