Added some comments

Added comments for clarity and fixed some issues dealing format