refactored stuff to get it working for me.