moves require statement into function