Improved comments and code