Made it purely functional