Reverted code to working version