Code cleanup - refactor