This works and has less code