Reverting merge #588 from qwook/master

I am reverting this commit until it is thoroughly tested and cleaned up.