Consolidate the code