I agree with Xassy, although I didn't use a crate - he had his own space....called bed! Also used specific words when taking him out the garden when he did his stuff together with loads of praise when the deed was done. Four years later, believe it or not, he still responds to the same words. Its a lot of work but if you make the effort in the early days it really, really pays off.
Also whenever he tries to do anything wrong a quick sharp NO! Make the boundaries, make sure you are in charge. A dog is a pack animal after all and you should be at the top of the pack. Believe it or not they like to know where they lie in the pack.