Cleaning up the code and replacing $ with Yaex.DOM