Reviewed and improved code