Modified some scripts/functions