Refactored a bit to support the new way of doing things in the latest HJS compiler update (0.9.6)