reverted to working code