Re-orgranized code