Added in guard testing, and moved require statements.