written the code for OS and main