Fixed and improved code.