cleanup
De-duplicate code