improved code
further improvements