Made functions safe by checking existence pre-call