modified for compatible with Phoenix Application