fixed bugs and did a few tweaks