Updated working version

Need to test