changed name and improved code