major bug fixes, still working on alignment bug