Controlling the stock

There is a tutorial done already on this topic one by Johan Alimohov

Stop selling out of stock items

but its not fully aligned.I cant understand the language the author is using.In the mean time let me attach some screen shots of what i have done