Writing the basic code