Writing the code