Added comments and logging (always good to have)