refactored a lot. cleaned up the code a lot.

you're welcome :D