90% complete, need to fix various bugs