This works a little more reliably now... fixed a lot of bugs and added functional polish. Needs heavy refactor.