major bug fixes, still not a working version