Some frontend cleanup. Not tested