Created metheods to make the code neater.