Fix bug and use better syntax