cleanup and added documentation