refactored slightly.. wasted a lot of time with that. :p