Re-Done custom functions