Merging the code all together