reverted code to working version