Added some commenting for clarity