Moved console stubbing code to separate file and added copyright notice