Code design improvings