rearranged require statements, added documentation