Uncommented out madeleyne's working code