Filled in missing functions, added documentation