Completed the basic code