Added some notes to research on and cleaned up some code