This should be rewritten using a Resource I think.