Simplified Remy's stringify function. Hopefully I didn't break it!