Tidy up the frontend code.