fixed bugs and fine tuned things