Cleaning up the code, and improving jade