Updated with more useable code