Wrote basic functionality. Untested