Minor cleanup and added documentation of existing functions