bug fixes
bug fixes and minor aesthetics. appears to work reasonably well now