Simplified the hell out of this shit. Almost readable! Added tests to check up on this stuff.
inline JavaScript?! BEGON!